// 存储数据
export const setItem = (key, value) => {
  window.localStorage.setItem(key, JSON.stringify(value))
}

// 获取数据
export const getItem = (key) => {
  const data = window.localStorage.getItem(key)
  try {
    return JSON.parse(data)
  } catch (error) {
    return '获取localStorage数据错误！'
  }
}

// 删除数据
export const removeItem = (key) => {
  window.localStorage.removeItem(key)
}